# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=opensmtpd-table-postgres
pkgver=1.1
pkgrel=0
pkgdesc="OpenSMTPD PostgreSQL tables"
url="https://github.com/OpenSMTPD/table-postgres"
arch="all"
license="ISC"
makedepends="
	autoconf
	automake
	libpq-dev
	"
subpackages="$pkgname-doc"
source="https://github.com/OpenSMTPD/table-postgres/archive/$pkgver/opensmtpd-table-postgres-$pkgver.tar.gz"
builddir="$srcdir/table-postgres-$pkgver"
options="!check"  # upstream does not provide tests

prepare() {
	default_prepare
	./bootstrap
}

build() {
	CFLAGS="$CFLAGS -I/usr/include/postgresql" \
	./configure \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--sysconfdir=/etc/smtpd
	make
}

package() {
	make DESTDIR="$pkgdir" smtpdir="/usr/lib/opensmtpd" install
}

sha512sums="
6dece1082a256a1d003f17dc2c64b19f789d6d0575106c479079a6c76e23e78a768360233d9a6e68c55453eb88ec6ee7591183ef7cb196b7334360323c329db3  opensmtpd-table-postgres-1.1.tar.gz
"
